<?php namespace App\Filters;

use App\Traits\FilterHelpers;
use EloquentFilter\ModelFilter;

class TagFilter extends ModelFilter
{
    use FilterHelpers;
    /**
     * Related Models that have ModelFilters as well as the method on the ModelFilter
     * As [relationMethod => [input_key1, input_key2]].
     *
     * @var array
     */
    public $relations = [];

    public function hot($count)
    {
        $this->has('articles', '>=', 5)->take($count);
    }

    public function trashed($value)
    {
        switch ($value) {
            case 'only':
                $this->onlyTrashed();
                break;
            case 'with':
                $this->withTrashed();
                break;
            case 'without':
                $this->withoutTrashed();
                break;
        }
    }
}
